#!/usr/bin/env python
# encoding: utf-8

import os
import argparse
import numpy as np

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--src_trials_path', help='src_trials_path', type=str, default="trials.lst")
    parser.add_argument('--dst_trials_path', help='dst_trials_path', type=str, default="trials.npy")
    parser.add_argument('--npy_dir', help='npy dir', type=str, default="npy")
    args = parser.parse_args()

    def format_fuc(x):
        x[0] = os.path.join(args.npy_dir, "enroll", x[0]) + ".npy"
        x[1] = os.path.join(args.npy_dir, x[1].strip(".wav") + ".npy")
        return x[0], x[1], x[2]

    trials = np.loadtxt(args.src_trials_path, dtype=np.str).tolist()
    trials = list(map(format_fuc, trials))
    np.save(args.dst_trials_path, trials)
    print("sucessfully save to {}".format(args.dst_trials_path))


